﻿using StreamServeDSIGenerator.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StreamServeDSIGenerator.Business
{
    public class Initialize
    {
        private List<SearchDialogEnt> populatedSearchDialogEnt = new List<SearchDialogEnt>() 
        {
            new SearchDialogEnt(){ displayLabel = "--Please select a Pattern--", itemValue=""},
            new SearchDialogEnt(){ displayLabel = "Email", itemValue="[^#]*@[^#]*"},
            new SearchDialogEnt(){ displayLabel = "Other", itemValue=""}
        };
        public ComboBox SearchDialogCombobox { set; get; }
        public TextBox SearchDialogTextBox { set; get; }

        public void initSearchDialog()
        {
            
            SearchDialogCombobox.DataSource = populatedSearchDialogEnt;
            SearchDialogCombobox.DisplayMember = "displayLabel";
            SearchDialogCombobox.ValueMember = "itemValue";
        }

        public void SearchDialogComboboxEventChanged()
        {
            SearchDialogTextBox.Text = "";
            SearchDialogTextBox.ReadOnly = false;
           
            if (SearchDialogCombobox.SelectedIndex == 0)
            {
                SearchDialogTextBox.ReadOnly = true;
            }
            else if (SearchDialogCombobox.SelectedIndex > 0 && SearchDialogCombobox.SelectedIndex != 2)
            {
                SearchDialogTextBox.Text = SearchDialogCombobox.SelectedValue.ToString();
            }
      

        }



    }
}
